#pragma once

#include "TextStreamInterface.h"
#include "WorkModeMenuInterface.h"
#include "WorkModeMenuTextLocalizationInterface.h"

class WorkModeMenuText;
typedef Factory < WorkModeMenuInterface >::CastedPtr < WorkModeMenuText > WorkModeMenuTextPtr;

class WorkModeMenuText
: public WorkModeMenuInterface
{
	friend class Factory < WorkModeMenuInterface >;
public:
	static WorkModeMenuInterfacePtr Spawn ( WorkModeMenuTextLocalizationInterfacePtr localization, TextStreamInterfacePtr textStream );
	static void CheckInnocence ();
private:
	WorkModeMenuText ();
	virtual void Run ( WorkModeReceiverInterfacePtr receiver );
	void RenderMenu ();
	void AcquireUserSelection ();
	void RenderInputWelcome ();
	void ReadSelectionFromStdIn ();
	bool SelectionMade ();
	void RenderInvalidSelection ();
private:
	char selection;
	WorkModeMenuTextLocalizationInterfacePtr localization;
	WorkModeReceiverInterfacePtr receiver;
	TextStreamInterfacePtr textStream;
	static Factory < WorkModeMenuInterface > factory;
};

